-- Author      : Kurapica
-- Create Date :  03/04/2009

--[[
	In-Game Addon System
	Studio
	Widget Panel
--]]

do	
	local CreateFrame = IGAS.GUI.CreateFrame
	local Widget = IGAS.Studio.Widget
	local RegisterWidgets = IGAS.GUI.Widget
	local UIParent = IGAS.Studio.UIParent

	local BaseWidget = {
	    ["UIObject"] = true,
	    ["VirtualUIObject"] = true,
	    ["FontInstance"] = true,
	    ["Region"] = true,
	    ["Font"] = true,
	    ["Frame"] = true,
	    ["FontFrame"] = true,
	    ["LayeredRegion"] = true,
	    ["Button"] = true,
	    ["Cooldown"] = true,
	    ["ColorSelect"] = true,
	    ["EditBox"] = true,
	    ["GameTooltip"] = true,
	    ["MessageFrame"] = true,
	    ["Minimap"] = true,
	    ["Model"] = true,
	    ["ScrollFrame"] = true,
	    ["ScrollingMessageFrame"] = true,
	    ["SimpleHTML"] = true,
	    ["Slider"] = true,
	    ["StatusBar"] = true,
	    ["CheckButton"] = true,
	    ["PlayerModel"] = true,
	    ["DressUpModel"] = true,
	    ["TabardModel"] = true,
	    ["Texture"] = true,
	    ["FontString"] = true,
	}

	local widgetList = CreateFrame(Widget.WidgetList, "IGAS_STUDIO_WidgetList", UIParent)
	local widgetBtn

	for i in pairs(BaseWidget) do
	    if RegisterWidgets[i].New then
	        widgetBtn = widgetList:AddWidget("Base", i)
			-- RegisterDefaultValue
			if widgetBtn and widgetBtn.Widget then
				IGAS.Studio:RegisterDefaultValue(widgetBtn.Widget)
			end
	    end
	end

	widgetList:GetGroup("Base").ToggleState = false
	
	for i in pairs(RegisterWidgets) do
	    if not BaseWidget[i] and RegisterWidgets[i].New then
	        widgetBtn = widgetList:AddWidget("Custom", i)
			-- RegisterDefaultValue
			if widgetBtn and widgetBtn.Widget then
				IGAS.Studio:RegisterDefaultValue(widgetBtn.Widget)
			end
	     end
	end	
end